import React from 'react'
import { useContext } from 'react';
//3. 导入 context 对象
import {context} from './A';

export default function C() {
  //4. 使用 context 对象
  let [count, setCount] = useContext(context);

  return (
    <div>
      <div>C组件</div>
      <h1>{count}</h1>
      <button onClick={() => {
        setCount(count - 1);
      }}>减少 count</button>
    </div>
  )
}
